<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>预定义常量</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="stream.resources.html">Stream Classes</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="stream.filters.html">Stream Filters</a></div>
 <div class="up"><a href="book.stream.html">Streams</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="stream.constants" class="appendix">
 <h1>预定义常量</h1>

 <p class="simpara">下列常量由此扩展定义，且仅在此扩展编译入 PHP 或在运行时动态载入时可用。</p>
 <p class="para">
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Constant</th>
      <th>Description</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr id="constant.stream-filter-read">
      <td><strong><code>STREAM_FILTER_READ</code></strong> *</td>
      <td>
       Used with <span class="function"><a href="function.stream-filter-append.html" class="function">stream_filter_append()</a></span> and
       <span class="function"><a href="function.stream-filter-prepend.html" class="function">stream_filter_prepend()</a></span> to indicate
       that the specified filter should only be applied when
       <em class="emphasis">reading</em>
      </td>
     </tr>

     <tr id="constant.stream-filter-write">
      <td><strong><code>STREAM_FILTER_WRITE</code></strong> *</td>
      <td>
       Used with <span class="function"><a href="function.stream-filter-append.html" class="function">stream_filter_append()</a></span> and
       <span class="function"><a href="function.stream-filter-prepend.html" class="function">stream_filter_prepend()</a></span> to indicate
       that the specified filter should only be applied when
       <em class="emphasis">writing</em>
      </td>
     </tr>

     <tr id="constant.stream-filter-all">
      <td><strong><code>STREAM_FILTER_ALL</code></strong> *</td>
      <td>
       This constant is equivalent to 
       <code class="code">STREAM_FILTER_READ | STREAM_FILTER_WRITE</code>
      </td>
     </tr>

     <tr id="constant.psfs-pass-on">
      <td><strong><code>PSFS_PASS_ON</code></strong> *</td>
      <td><em>Return Code</em> indicating that the
       userspace filter returned buckets in <em><code class="parameter">$out</code></em>.
      </td>
     </tr>

     <tr id="constant.psfs-feed-me">
      <td><strong><code>PSFS_FEED_ME</code></strong> *</td>
      <td><em>Return Code</em> indicating that the
       userspace filter did not return buckets in <em><code class="parameter">$out</code></em>
       (i.e. No data available).
      </td>
     </tr>

     <tr id="constant.psfs-err-fatal">
      <td><strong><code>PSFS_ERR_FATAL</code></strong> *</td>
      <td><em>Return Code</em> indicating that the
       userspace filter encountered an unrecoverable error
       (i.e. Invalid data received).
      </td>
     </tr>

     <tr id="constant.psfs-flag-normal">
      <td><strong><code>PSFS_FLAG_NORMAL</code></strong></td>
      <td>Regular read/write.</td>
     </tr>

     <tr id="constant.psfs-flag-flush-inc">
      <td><strong><code>PSFS_FLAG_FLUSH_INC</code></strong></td>
      <td>An incremental flush.</td>
     </tr>

     <tr id="constant.psfs-flag-flush-close">
      <td><strong><code>PSFS_FLAG_FLUSH_CLOSE</code></strong></td>
      <td>Final flush prior to closing.</td>
     </tr>

     <tr id="constant.stream-use-path">
      <td><strong><code>STREAM_USE_PATH</code></strong></td>
      <td><em>Flag</em> indicating if the <em>stream</em>
       used the include path.
      </td>
     </tr>

     <tr id="constant.stream-report-errors">
      <td><strong><code>STREAM_REPORT_ERRORS</code></strong></td>
      <td><em>Flag</em> indicating if the <em>wrapper</em>
       is responsible for raising errors using <span class="function"><a href="function.trigger-error.html" class="function">trigger_error()</a></span> 
       during opening of the stream.  If this flag is not set, you
       should not raise any errors.
      </td>
     </tr>

     <tr id="constant.stream-client-async-connect">
      <td><strong><code>STREAM_CLIENT_ASYNC_CONNECT</code></strong> *</td>
      <td>Open client socket asynchronously. This option must be used
       together with the <strong><code>STREAM_CLIENT_CONNECT</code></strong> flag.
       Used with <span class="function"><a href="function.stream-socket-client.html" class="function">stream_socket_client()</a></span>.
      </td>
     </tr>

     <tr id="constant.stream-client-connect">
      <td><strong><code>STREAM_CLIENT_CONNECT</code></strong> *</td>
      <td>Open client socket connection. Client sockets should always
       include this flag. Used with <span class="function"><a href="function.stream-socket-client.html" class="function">stream_socket_client()</a></span>.
      </td>
     </tr>

     <tr id="constant.stream-client-persistent">
      <td><strong><code>STREAM_CLIENT_PERSISTENT</code></strong> *</td>
      <td>Client socket opened with <span class="function"><a href="function.stream-socket-client.html" class="function">stream_socket_client()</a></span>
       should remain persistent between page loads.
      </td>
     </tr>

     <tr id="constant.stream-server-bind">
      <td><strong><code>STREAM_SERVER_BIND</code></strong> *</td>
      <td>Tells a stream created with <span class="function"><a href="function.stream-socket-server.html" class="function">stream_socket_server()</a></span>
       to bind to the specified target.  Server sockets should always include this flag.
      </td>
     </tr>

     <tr id="constant.stream-server-listen">
      <td><strong><code>STREAM_SERVER_LISTEN</code></strong> *</td>
      <td>Tells a stream created with <span class="function"><a href="function.stream-socket-server.html" class="function">stream_socket_server()</a></span>
       and bound using the <strong><code>STREAM_SERVER_BIND</code></strong> flag to start
       listening on the socket. Connection-orientated transports (such as TCP)
       must use this flag, otherwise the server socket will not be enabled.
       Using this flag for connect-less transports (such as UDP) is an error.
      </td>
     </tr>

     <tr id="constant.stream-notify-resolve">
      <td><strong><code>STREAM_NOTIFY_RESOLVE</code></strong> *</td>
      <td>
       A remote address required for this stream has been resolved, or the resolution
       failed.  See <em><code class="parameter">severity</code></em> for an indication of which happened.
      </td>
     </tr>

     <tr id="constant.stream-notify-connect">
      <td><strong><code>STREAM_NOTIFY_CONNECT</code></strong></td>
      <td>
       A connection with an external resource has been established.
      </td>
     </tr>

     <tr id="constant.stream-notify-auth-required">
      <td><strong><code>STREAM_NOTIFY_AUTH_REQUIRED</code></strong></td>
      <td>
       Additional authorization is required to access the specified resource.
       Typical issued with <em><code class="parameter">severity</code></em> level of
       <strong><code>STREAM_NOTIFY_SEVERITY_ERR</code></strong>.
      </td>
     </tr>

     <tr id="constant.stream-notify-mime-type-is">
      <td><strong><code>STREAM_NOTIFY_MIME_TYPE_IS</code></strong></td>
      <td>
       The <em>mime-type</em> of resource has been identified,
       refer to <em><code class="parameter">message</code></em> for a description of the
       discovered type.
      </td>
     </tr>

     <tr id="constant.stream-notify-file-size-is">
      <td><strong><code>STREAM_NOTIFY_FILE_SIZE_IS</code></strong></td>
      <td>
       The <em>size</em> of the resource has been discovered.
      </td>
     </tr>

     <tr id="constant.stream-notify-redirected">
      <td><strong><code>STREAM_NOTIFY_REDIRECTED</code></strong></td>
      <td>
       The external resource has redirected the stream to an alternate
       location.  Refer to <em><code class="parameter">message</code></em>.
      </td>
     </tr>

     <tr id="constant.stream-notify-progress">
      <td><strong><code>STREAM_NOTIFY_PROGRESS</code></strong></td>
      <td>
       Indicates current progress of the stream transfer in
       <em><code class="parameter">bytes_transferred</code></em> and possibly
       <em><code class="parameter">bytes_max</code></em> as well.
      </td>
     </tr>

     <tr id="constant.stream-notify-completed">
      <td><strong><code>STREAM_NOTIFY_COMPLETED</code></strong> *</td>
      <td>
       There is no more data available on the stream.
      </td>
     </tr>

     <tr id="constant.stream-notify-failure">
      <td><strong><code>STREAM_NOTIFY_FAILURE</code></strong></td>
      <td>
       A generic error occurred on the stream, consult
       <em><code class="parameter">message</code></em> and <em><code class="parameter">message_code</code></em>
       for details.
      </td>
     </tr>

     <tr id="constant.stream-notify-auth-result">
      <td><strong><code>STREAM_NOTIFY_AUTH_RESULT</code></strong></td>
      <td>
       Authorization has been completed (with or without success).
      </td>
     </tr>

     <tr id="constant.stream-notify-severity-info">
      <td><strong><code>STREAM_NOTIFY_SEVERITY_INFO</code></strong></td>
      <td>
       Normal, non-error related, notification.
      </td>
     </tr>

     <tr id="constant.stream-notify-severity-warn">
      <td><strong><code>STREAM_NOTIFY_SEVERITY_WARN</code></strong></td>
      <td>
       Non critical error condition.  Processing may continue.
      </td>
     </tr>

     <tr id="constant.stream-notify-severity-err">
      <td><strong><code>STREAM_NOTIFY_SEVERITY_ERR</code></strong></td>
      <td>
       A critical error occurred.  Processing cannot continue.
      </td>
     </tr>

     <tr id="constant.stream-ipproto-icmp">
      <td><strong><code>STREAM_IPPROTO_ICMP</code></strong> +</td>
      <td>
       Provides a ICMP socket.
      </td>
     </tr>

     <tr id="constant.stream-ipproto-ip">
      <td><strong><code>STREAM_IPPROTO_IP</code></strong> +</td>
      <td>
       Provides a IP socket.
      </td>
     </tr>

     <tr id="constant.stream-ipproto-raw">
      <td><strong><code>STREAM_IPPROTO_RAW</code></strong> +</td>
      <td>
       Provides a RAW socket.
      </td>
     </tr>

     <tr id="constant.stream-ipproto-tcp">
      <td><strong><code>STREAM_IPPROTO_TCP</code></strong> +</td>
      <td>
       Provides a TCP socket.
      </td>
     </tr>

     <tr id="constant.stream-ipproto-udp">
      <td><strong><code>STREAM_IPPROTO_UDP</code></strong> +</td>
      <td>
       Provides a UDP socket.
      </td>
     </tr>

     <tr id="constant.stream-pf-inet">
      <td><strong><code>STREAM_PF_INET</code></strong> +</td>
      <td>
       Internet Protocol Version 4 (IPv4).
      </td>
     </tr>

     <tr id="constant.stream-pf-inet6">
      <td><strong><code>STREAM_PF_INET6</code></strong> +</td>
      <td>
       Internet Protocol Version 6 (IPv6).
      </td>
     </tr>

     <tr id="constant.stream-pf-unix">
      <td><strong><code>STREAM_PF_UNIX</code></strong> +</td>
      <td>
       Unix system internal protocols.
      </td>
     </tr>

     <tr id="constant.stream-sock-dgram">
      <td><strong><code>STREAM_SOCK_DGRAM</code></strong> +</td>
      <td>
       Provides datagrams, which are connectionless messages (UDP, for
       example).
      </td>
     </tr>

     <tr id="constant.stream-sock-raw">
      <td><strong><code>STREAM_SOCK_RAW</code></strong> +</td>
      <td>
       Provides a raw socket, which provides access to internal network
       protocols and interfaces. Usually this type of socket is just available
       to the root user.
      </td>
     </tr>

     <tr id="constant.stream-sock-rdm">
      <td><strong><code>STREAM_SOCK_RDM</code></strong> +</td>
      <td>
       Provides a RDM (Reliably-delivered messages) socket.
      </td>
     </tr>

     <tr id="constant.stream-sock-seqpacket">
      <td><strong><code>STREAM_SOCK_SEQPACKET</code></strong> +</td>
      <td>
       Provides a sequenced packet stream socket.
      </td>
     </tr>

     <tr id="constant.stream-sock-stream">
      <td><strong><code>STREAM_SOCK_STREAM</code></strong> +</td>
      <td>
       Provides sequenced, two-way byte streams with a transmission mechanism
       for out-of-band data (TCP, for example).
      </td>
     </tr>

     <tr id="constant.stream-shut-rd">
      <td><strong><code>STREAM_SHUT_RD</code></strong></td>
      <td>
       Used with <span class="function"><a href="function.stream-socket-shutdown.html" class="function">stream_socket_shutdown()</a></span> to disable
       further receptions. Added in PHP 5.2.1.
      </td>
     </tr>

     <tr id="constant.stream-shut-wr">
      <td><strong><code>STREAM_SHUT_WR</code></strong></td>
      <td>
       Used with <span class="function"><a href="function.stream-socket-shutdown.html" class="function">stream_socket_shutdown()</a></span> to disable
       further transmissions. Added in PHP 5.2.1.
      </td>
     </tr>

     <tr id="constant.stream-shut-rdwr">
      <td><strong><code>STREAM_SHUT_RDWR</code></strong></td>
      <td>
       Used with <span class="function"><a href="function.stream-socket-shutdown.html" class="function">stream_socket_shutdown()</a></span> to disable
       further receptions and transmissions. Added in PHP 5.2.1.
      </td>
     </tr>

     <tr id="constant.stream-cast-for-select">
      <td><strong><code>STREAM_CAST_FOR_SELECT</code></strong></td>
      <td>
       Stream casting, for when <span class="function"><a href="function.stream-select.html" class="function">stream_select()</a></span> is 
       calling <span class="function"><strong>stream_cast()</strong></span>.
      </td>
     </tr>

     <tr id="constant.stream-cast-as-stream">
      <td><strong><code>STREAM_CAST_AS_STREAM</code></strong></td>
      <td>
       Stream casting, when <span class="function"><strong>stream_cast()</strong></span> is called 
       otherwise (see above).
      </td>
     </tr>

     <tr id="constant.stream-meta-touch">
      <td><strong><code>STREAM_META_TOUCH</code></strong></td>
      <td>
       Used with <span class="function"><strong>stream_metadata()</strong></span>, to specify <span class="function"><a href="function.touch.html" class="function">touch()</a></span> call.
      </td>
     </tr>

     <tr id="constant.stream-meta-owner">
      <td><strong><code>STREAM_META_OWNER</code></strong></td>
      <td>
       Used with <span class="function"><strong>stream_metadata()</strong></span>, to specify <span class="function"><a href="function.chown.html" class="function">chown()</a></span> call.
      </td>
     </tr>

     <tr id="constant.stream-meta-owner-name">
      <td><strong><code>STREAM_META_OWNER_NAME</code></strong></td>
      <td>
       Used with <span class="function"><strong>stream_metadata()</strong></span>, to specify <span class="function"><a href="function.chown.html" class="function">chown()</a></span> call.
      </td>
     </tr>

     <tr id="constant.stream-meta-group">
      <td><strong><code>STREAM_META_GROUP</code></strong></td>
      <td>
       Used with <span class="function"><strong>stream_metadata()</strong></span>, to specify <span class="function"><a href="function.chgrp.html" class="function">chgrp()</a></span> call.
      </td>
     </tr>

     <tr id="constant.stream-meta-group-name">
      <td><strong><code>STREAM_META_GROUP_NAME</code></strong></td>
      <td>
       Used with <span class="function"><strong>stream_metadata()</strong></span>, to specify <span class="function"><a href="function.chgrp.html" class="function">chgrp()</a></span> call.
      </td>
     </tr>

     <tr id="constant.stream-meta-access">
      <td><strong><code>STREAM_META_ACCESS</code></strong></td>
      <td>
       Used with <span class="function"><strong>stream_metadata()</strong></span>, to specify <span class="function"><a href="function.chmod.html" class="function">chmod()</a></span> call.
      </td>
     </tr>

    </tbody>
   
  </table>

 </p>
 <blockquote class="note"><p><strong class="note">Note</strong>: 
  <span class="simpara">
   The constants marked with <em>*</em> are just available since
   PHP 5.0.0.
  </span>
 </p></blockquote>
 <blockquote class="note"><p><strong class="note">Note</strong>: 
  <span class="simpara">
   The constants marked with <em>+</em> are available since PHP
   5.1.0 and are meant to be used with
   <span class="function"><a href="function.stream-socket-pair.html" class="function">stream_socket_pair()</a></span>. Please note that some of these
   constants might not be available in your system.
  </span>
 </p></blockquote>
 <blockquote class="note"><p><strong class="note">Note</strong>: 
  <span class="simpara">
   The <strong><code>STREAM_META_*</code></strong> constants are available since PHP
   5.4.0 and are meant to be used with <span class="function"><strong>stream_metadata()</strong></span>. 
  </span>
 </p></blockquote>
</div>
<hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="stream.resources.html">Stream Classes</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="stream.filters.html">Stream Filters</a></div>
 <div class="up"><a href="book.stream.html">Streams</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
